<?xml version="1.0" encoding="ascii"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
          "DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
  <title>reporting.ReportRunner</title>
  <link rel="stylesheet" href="epydoc.css" type="text/css" />
  <script type="text/javascript" src="epydoc.js"></script>
</head>

<body bgcolor="white" text="black" link="blue" vlink="#204080"
      alink="#204080">
<!-- ==================== NAVIGATION BAR ==================== -->
<table class="navbar" border="0" width="100%" cellpadding="0"
       bgcolor="#a0c0ff" cellspacing="0">
  <tr valign="middle">

  <!-- Tree link -->
      <th>&nbsp;&nbsp;&nbsp;<a
        href="module-tree.html">Trees</a>&nbsp;&nbsp;&nbsp;</th>

  <!-- Index link -->
      <th>&nbsp;&nbsp;&nbsp;<a
        href="identifier-index.html">Indices</a>&nbsp;&nbsp;&nbsp;</th>

  <!-- Help link -->
      <th>&nbsp;&nbsp;&nbsp;<a
        href="help.html">Help</a>&nbsp;&nbsp;&nbsp;</th>

  <!-- Project homepage -->
      <th class="navbar" align="right" width="100%">
        <table border="0" cellpadding="0" cellspacing="0">
          <tr><th class="navbar" align="center"
            ><a class="navbar" target="_top" href="http://code.google.com/p/uprgae-console/">UPR-GAE console</a></th>
          </tr></table></th>
  </tr>
</table>
<table width="100%" cellpadding="0" cellspacing="0">
  <tr valign="top">
    <td width="100%">
      <span class="breadcrumbs">
        <a href="reporting-module.html">Module&nbsp;reporting</a> ::
        Class&nbsp;ReportRunner
      </span>
    </td>
    <td>
      <table cellpadding="0" cellspacing="0">
        <!-- hide/show private -->
        <tr><td align="right"><span class="options">[<a href="javascript:void(0);" class="privatelink"
    onclick="toggle_private();">hide&nbsp;private</a>]</span></td></tr>
        <tr><td align="right"><span class="options"
            >[<a href="frames.html" target="_top">frames</a
            >]&nbsp;|&nbsp;<a href="reporting.ReportRunner-class.html"
            target="_top">no&nbsp;frames</a>]</span></td></tr>
      </table>
    </td>
  </tr>
</table>
<!-- ==================== CLASS DESCRIPTION ==================== -->
<h1 class="epydoc">Class ReportRunner</h1><p class="nomargin-top"><span class="codelink"><a href="reporting-pysrc.html#ReportRunner">source&nbsp;code</a></span></p>
<p>This class contains the logic to generate a report from the Reporting 
  API web service.</p>

<!-- ==================== INSTANCE METHODS ==================== -->
<a name="section-InstanceMethods"></a>
<table class="summary" border="1" cellpadding="3"
       cellspacing="0" width="100%" bgcolor="white">
<tr bgcolor="#70b0f0" class="table-header">
  <td colspan="2" class="table-header">
    <table border="0" cellpadding="0" cellspacing="0" width="100%">
      <tr valign="top">
        <td align="left"><span class="table-header">Instance Methods</span></td>
        <td align="right" valign="top"
         ><span class="options">[<a href="#section-InstanceMethods"
         class="privatelink" onclick="toggle_private();"
         >hide private</a>]</span></td>
      </tr>
    </table>
  </td>
</tr>
<tr>
    <td width="15%" align="right" valign="top" class="summary">
      <span class="summary-type">&nbsp;</span>
    </td><td class="summary">
      <table width="100%" cellpadding="0" cellspacing="0" border="0">
        <tr>
          <td><span class="summary-sig"><a name="__init__"></a><span class="summary-sig-name">__init__</span>(<span class="summary-sig-arg">self</span>)</span><br />
      Construct an instance of the report runner.</td>
          <td align="right" valign="top">
            <span class="codelink"><a href="reporting-pysrc.html#ReportRunner.__init__">source&nbsp;code</a></span>
            
          </td>
        </tr>
      </table>
      
    </td>
  </tr>
<tr>
    <td width="15%" align="right" valign="top" class="summary">
      <span class="summary-type">&nbsp;</span>
    </td><td class="summary">
      <table width="100%" cellpadding="0" cellspacing="0" border="0">
        <tr>
          <td><span class="summary-sig"><a href="reporting.ReportRunner-class.html#GetAdminEmailDomain" class="summary-sig-name">GetAdminEmailDomain</a>(<span class="summary-sig-arg">self</span>)</span><br />
      Get administrator email adress domain.</td>
          <td align="right" valign="top">
            <span class="codelink"><a href="reporting-pysrc.html#ReportRunner.GetAdminEmailDomain">source&nbsp;code</a></span>
            
          </td>
        </tr>
      </table>
      
    </td>
  </tr>
<tr>
    <td width="15%" align="right" valign="top" class="summary">
      <span class="summary-type">&nbsp;</span>
    </td><td class="summary">
      <table width="100%" cellpadding="0" cellspacing="0" border="0">
        <tr>
          <td><span class="summary-sig"><a href="reporting.ReportRunner-class.html#GetLatestReportDate" class="summary-sig-name">GetLatestReportDate</a>(<span class="summary-sig-arg">self</span>)</span><br />
      Get the date of the latest available report.</td>
          <td align="right" valign="top">
            <span class="codelink"><a href="reporting-pysrc.html#ReportRunner.GetLatestReportDate">source&nbsp;code</a></span>
            
          </td>
        </tr>
      </table>
      
    </td>
  </tr>
<tr class="private">
    <td width="15%" align="right" valign="top" class="summary">
      <span class="summary-type">&nbsp;</span>
    </td><td class="summary">
      <table width="100%" cellpadding="0" cellspacing="0" border="0">
        <tr>
          <td><span class="summary-sig"><a href="reporting.ReportRunner-class.html#__PostUrl" class="summary-sig-name" onclick="show_private();">__PostUrl</a>(<span class="summary-sig-arg">self</span>,
        <span class="summary-sig-arg">url</span>,
        <span class="summary-sig-arg">data</span>,
        <span class="summary-sig-arg">gzip</span>=<span class="summary-sig-default">False</span>)</span><br />
      Post data to a URL.</td>
          <td align="right" valign="top">
            <span class="codelink"><a href="reporting-pysrc.html#ReportRunner.__PostUrl">source&nbsp;code</a></span>
            
          </td>
        </tr>
      </table>
      
    </td>
  </tr>
<tr>
    <td width="15%" align="right" valign="top" class="summary">
      <span class="summary-type">&nbsp;</span>
    </td><td class="summary">
      <table width="100%" cellpadding="0" cellspacing="0" border="0">
        <tr>
          <td><span class="summary-sig"><a href="reporting.ReportRunner-class.html#Login" class="summary-sig-name">Login</a>(<span class="summary-sig-arg">self</span>)</span><br />
      Get an authorization token from the Auth URL web service.</td>
          <td align="right" valign="top">
            <span class="codelink"><a href="reporting-pysrc.html#ReportRunner.Login">source&nbsp;code</a></span>
            
          </td>
        </tr>
      </table>
      
    </td>
  </tr>
<tr>
    <td width="15%" align="right" valign="top" class="summary">
      <span class="summary-type">&nbsp;</span>
    </td><td class="summary">
      <table width="100%" cellpadding="0" cellspacing="0" border="0">
        <tr>
          <td><span class="summary-sig"><a href="reporting.ReportRunner-class.html#GetReportData" class="summary-sig-name">GetReportData</a>(<span class="summary-sig-arg">self</span>,
        <span class="summary-sig-arg">report_request</span>)</span><br />
      Get the report data response from the Reporting API web service.</td>
          <td align="right" valign="top">
            <span class="codelink"><a href="reporting-pysrc.html#ReportRunner.GetReportData">source&nbsp;code</a></span>
            
          </td>
        </tr>
      </table>
      
    </td>
  </tr>
<tr>
    <td width="15%" align="right" valign="top" class="summary">
      <span class="summary-type">&nbsp;</span>
    </td><td class="summary">
      <table width="100%" cellpadding="0" cellspacing="0" border="0">
        <tr>
          <td><span class="summary-sig"><a href="reporting.ReportRunner-class.html#WriteReport" class="summary-sig-name">WriteReport</a>(<span class="summary-sig-arg">self</span>,
        <span class="summary-sig-arg">response</span>,
        <span class="summary-sig-arg">out_file_name</span>=<span class="summary-sig-default">None</span>)</span><br />
      Print the report response to either standard output or a file.</td>
          <td align="right" valign="top">
            <span class="codelink"><a href="reporting-pysrc.html#ReportRunner.WriteReport">source&nbsp;code</a></span>
            
          </td>
        </tr>
      </table>
      
    </td>
  </tr>
<tr>
    <td width="15%" align="right" valign="top" class="summary">
      <span class="summary-type">&nbsp;</span>
    </td><td class="summary">
      <table width="100%" cellpadding="0" cellspacing="0" border="0">
        <tr>
          <td><span class="summary-sig"><a href="reporting.ReportRunner-class.html#RunReport" class="summary-sig-name">RunReport</a>(<span class="summary-sig-arg">self</span>,
        <span class="summary-sig-arg">report_name</span>,
        <span class="summary-sig-arg">report_date</span>,
        <span class="summary-sig-arg">out_file_name</span>=<span class="summary-sig-default">None</span>,
        <span class="summary-sig-arg">page_requested</span>=<span class="summary-sig-default">None</span>)</span><br />
      Run the named report for the given day and write to the output file.</td>
          <td align="right" valign="top">
            <span class="codelink"><a href="reporting-pysrc.html#ReportRunner.RunReport">source&nbsp;code</a></span>
            
          </td>
        </tr>
      </table>
      
    </td>
  </tr>
</table>
<!-- ==================== CLASS VARIABLES ==================== -->
<a name="section-ClassVariables"></a>
<table class="summary" border="1" cellpadding="3"
       cellspacing="0" width="100%" bgcolor="white">
<tr bgcolor="#70b0f0" class="table-header">
  <td colspan="2" class="table-header">
    <table border="0" cellpadding="0" cellspacing="0" width="100%">
      <tr valign="top">
        <td align="left"><span class="table-header">Class Variables</span></td>
        <td align="right" valign="top"
         ><span class="options">[<a href="#section-ClassVariables"
         class="privatelink" onclick="toggle_private();"
         >hide private</a>]</span></td>
      </tr>
    </table>
  </td>
</tr>
<tr class="private">
    <td width="15%" align="right" valign="top" class="summary">
      <span class="summary-type">&nbsp;</span>
    </td><td class="summary">
        <a name="_AUTH_URL"></a><span class="summary-name">_AUTH_URL</span> = <code title="'https://www.google.com/accounts/ClientLogin'"><code class="variable-quote">'</code><code class="variable-string">https://www.google.com/accounts/ClientLogin</code><code class="variable-quote">'</code></code>
    </td>
  </tr>
<tr class="private">
    <td width="15%" align="right" valign="top" class="summary">
      <span class="summary-type">&nbsp;</span>
    </td><td class="summary">
        <a href="reporting.ReportRunner-class.html#_REPORTING_URL" class="summary-name" onclick="show_private();">_REPORTING_URL</a> = <code title="'https://www.google.com/hosted/services/v1.0/reports/ReportingData'"><code class="variable-quote">'</code><code class="variable-string">https://www.google.com/hosted/services/v1.0/</code><code class="variable-ellipsis">...</code></code>
    </td>
  </tr>
</table>
<!-- ==================== METHOD DETAILS ==================== -->
<a name="section-MethodDetails"></a>
<table class="details" border="1" cellpadding="3"
       cellspacing="0" width="100%" bgcolor="white">
<tr bgcolor="#70b0f0" class="table-header">
  <td colspan="2" class="table-header">
    <table border="0" cellpadding="0" cellspacing="0" width="100%">
      <tr valign="top">
        <td align="left"><span class="table-header">Method Details</span></td>
        <td align="right" valign="top"
         ><span class="options">[<a href="#section-MethodDetails"
         class="privatelink" onclick="toggle_private();"
         >hide private</a>]</span></td>
      </tr>
    </table>
  </td>
</tr>
</table>
<a name="GetAdminEmailDomain"></a>
<div>
<table class="details" border="1" cellpadding="3"
       cellspacing="0" width="100%" bgcolor="white">
<tr><td>
  <table width="100%" cellpadding="0" cellspacing="0" border="0">
  <tr valign="top"><td>
  <h3 class="epydoc"><span class="sig"><span class="sig-name">GetAdminEmailDomain</span>(<span class="sig-arg">self</span>)</span>
  </h3>
  </td><td align="right" valign="top"
    ><span class="codelink"><a href="reporting-pysrc.html#ReportRunner.GetAdminEmailDomain">source&nbsp;code</a></span>&nbsp;
    </td>
  </tr></table>
  
  <pre class="literalblock">
Get administrator email adress domain.

Returns:
  The domain portion of the administrator email address.
  e.g. For admin@example.com returns example.com

</pre>
  <dl class="fields">
  </dl>
</td></tr></table>
</div>
<a name="GetLatestReportDate"></a>
<div>
<table class="details" border="1" cellpadding="3"
       cellspacing="0" width="100%" bgcolor="white">
<tr><td>
  <table width="100%" cellpadding="0" cellspacing="0" border="0">
  <tr valign="top"><td>
  <h3 class="epydoc"><span class="sig"><span class="sig-name">GetLatestReportDate</span>(<span class="sig-arg">self</span>)</span>
  </h3>
  </td><td align="right" valign="top"
    ><span class="codelink"><a href="reporting-pysrc.html#ReportRunner.GetLatestReportDate">source&nbsp;code</a></span>&nbsp;
    </td>
  </tr></table>
  
  <pre class="literalblock">
Get the date of the latest available report.

Reports for the current date are available after 12:00 PST8PDT the following
day.  We calculate and return the date of the latest available report based
on the current time.  The PyTZ library can be used to calculate this more
accurately, however since it is not part of a standard python installation
we use -0800 as an approximation for the PST8PDT timezone.

Returns:
  Latest report date.

</pre>
  <dl class="fields">
  </dl>
</td></tr></table>
</div>
<a name="__PostUrl"></a>
<div class="private">
<table class="details" border="1" cellpadding="3"
       cellspacing="0" width="100%" bgcolor="white">
<tr><td>
  <table width="100%" cellpadding="0" cellspacing="0" border="0">
  <tr valign="top"><td>
  <h3 class="epydoc"><span class="sig"><span class="sig-name">__PostUrl</span>(<span class="sig-arg">self</span>,
        <span class="sig-arg">url</span>,
        <span class="sig-arg">data</span>,
        <span class="sig-arg">gzip</span>=<span class="sig-default">False</span>)</span>
  </h3>
  </td><td align="right" valign="top"
    ><span class="codelink"><a href="reporting-pysrc.html#ReportRunner.__PostUrl">source&nbsp;code</a></span>&nbsp;
    </td>
  </tr></table>
  
  <pre class="literalblock">
Post data to a URL.

Args:
  url: URL to post to.
  data: data to post

Raises:
  ConnectionError: When a connection error occurs or an HTTP response
    error code is returned.

</pre>
  <dl class="fields">
  </dl>
</td></tr></table>
</div>
<a name="Login"></a>
<div>
<table class="details" border="1" cellpadding="3"
       cellspacing="0" width="100%" bgcolor="white">
<tr><td>
  <table width="100%" cellpadding="0" cellspacing="0" border="0">
  <tr valign="top"><td>
  <h3 class="epydoc"><span class="sig"><span class="sig-name">Login</span>(<span class="sig-arg">self</span>)</span>
  </h3>
  </td><td align="right" valign="top"
    ><span class="codelink"><a href="reporting-pysrc.html#ReportRunner.Login">source&nbsp;code</a></span>&nbsp;
    </td>
  </tr></table>
  
  <pre class="literalblock">
Get an authorization token from the Auth URL web service.

This authorization token is cached in the ReportRunner instance.  If a new
token is needed, for example if the token is 24 hours old, then call this
method again to get a new token.

Raises:
  ConnectionError: When a connection error occurs and in particular
    when the credentials are incorrect.
  LoginError: When authentication service does not return a SID token.

</pre>
  <dl class="fields">
  </dl>
</td></tr></table>
</div>
<a name="GetReportData"></a>
<div>
<table class="details" border="1" cellpadding="3"
       cellspacing="0" width="100%" bgcolor="white">
<tr><td>
  <table width="100%" cellpadding="0" cellspacing="0" border="0">
  <tr valign="top"><td>
  <h3 class="epydoc"><span class="sig"><span class="sig-name">GetReportData</span>(<span class="sig-arg">self</span>,
        <span class="sig-arg">report_request</span>)</span>
  </h3>
  </td><td align="right" valign="top"
    ><span class="codelink"><a href="reporting-pysrc.html#ReportRunner.GetReportData">source&nbsp;code</a></span>&nbsp;
    </td>
  </tr></table>
  
  <pre class="literalblock">
Get the report data response from the Reporting API web service.

Args:
  report_request: Reporting API request.

Returns:
  Report data response as a string.

</pre>
  <dl class="fields">
  </dl>
</td></tr></table>
</div>
<a name="WriteReport"></a>
<div>
<table class="details" border="1" cellpadding="3"
       cellspacing="0" width="100%" bgcolor="white">
<tr><td>
  <table width="100%" cellpadding="0" cellspacing="0" border="0">
  <tr valign="top"><td>
  <h3 class="epydoc"><span class="sig"><span class="sig-name">WriteReport</span>(<span class="sig-arg">self</span>,
        <span class="sig-arg">response</span>,
        <span class="sig-arg">out_file_name</span>=<span class="sig-default">None</span>)</span>
  </h3>
  </td><td align="right" valign="top"
    ><span class="codelink"><a href="reporting-pysrc.html#ReportRunner.WriteReport">source&nbsp;code</a></span>&nbsp;
    </td>
  </tr></table>
  
  <pre class="literalblock">
Print the report response to either standard output or a file.

Args:
  response: Report data response.
  out_file_name: Output file name (optional).

</pre>
  <dl class="fields">
  </dl>
</td></tr></table>
</div>
<a name="RunReport"></a>
<div>
<table class="details" border="1" cellpadding="3"
       cellspacing="0" width="100%" bgcolor="white">
<tr><td>
  <table width="100%" cellpadding="0" cellspacing="0" border="0">
  <tr valign="top"><td>
  <h3 class="epydoc"><span class="sig"><span class="sig-name">RunReport</span>(<span class="sig-arg">self</span>,
        <span class="sig-arg">report_name</span>,
        <span class="sig-arg">report_date</span>,
        <span class="sig-arg">out_file_name</span>=<span class="sig-default">None</span>,
        <span class="sig-arg">page_requested</span>=<span class="sig-default">None</span>)</span>
  </h3>
  </td><td align="right" valign="top"
    ><span class="codelink"><a href="reporting-pysrc.html#ReportRunner.RunReport">source&nbsp;code</a></span>&nbsp;
    </td>
  </tr></table>
  
  <pre class="literalblock">
Run the named report for the given day and write to the output file.

Args:
  report_name: Name of the report to run.
  report_date: Run the report for this day.
  out_file_name: Write the report data to this file (optional).

</pre>
  <dl class="fields">
  </dl>
</td></tr></table>
</div>
<br />
<!-- ==================== CLASS VARIABLE DETAILS ==================== -->
<a name="section-ClassVariableDetails"></a>
<table class="details" border="1" cellpadding="3"
       cellspacing="0" width="100%" bgcolor="white">
<tr bgcolor="#70b0f0" class="table-header">
  <td colspan="2" class="table-header">
    <table border="0" cellpadding="0" cellspacing="0" width="100%">
      <tr valign="top">
        <td align="left"><span class="table-header">Class Variable Details</span></td>
        <td align="right" valign="top"
         ><span class="options">[<a href="#section-ClassVariableDetails"
         class="privatelink" onclick="toggle_private();"
         >hide private</a>]</span></td>
      </tr>
    </table>
  </td>
</tr>
</table>
<a name="_REPORTING_URL"></a>
<div class="private">
<table class="details" border="1" cellpadding="3"
       cellspacing="0" width="100%" bgcolor="white">
<tr><td>
  <h3 class="epydoc">_REPORTING_URL</h3>
  
  <dl class="fields">
  </dl>
  <dl class="fields">
    <dt>Value:</dt>
      <dd><table><tr><td><pre class="variable">
<code class="variable-quote">'</code><code class="variable-string">https://www.google.com/hosted/services/v1.0/reports/ReportingData</code><code class="variable-quote">'</code>
</pre></td></tr></table>
</dd>
  </dl>
</td></tr></table>
</div>
<br />
<!-- ==================== NAVIGATION BAR ==================== -->
<table class="navbar" border="0" width="100%" cellpadding="0"
       bgcolor="#a0c0ff" cellspacing="0">
  <tr valign="middle">

  <!-- Tree link -->
      <th>&nbsp;&nbsp;&nbsp;<a
        href="module-tree.html">Trees</a>&nbsp;&nbsp;&nbsp;</th>

  <!-- Index link -->
      <th>&nbsp;&nbsp;&nbsp;<a
        href="identifier-index.html">Indices</a>&nbsp;&nbsp;&nbsp;</th>

  <!-- Help link -->
      <th>&nbsp;&nbsp;&nbsp;<a
        href="help.html">Help</a>&nbsp;&nbsp;&nbsp;</th>

  <!-- Project homepage -->
      <th class="navbar" align="right" width="100%">
        <table border="0" cellpadding="0" cellspacing="0">
          <tr><th class="navbar" align="center"
            ><a class="navbar" target="_top" href="http://code.google.com/p/uprgae-console/">UPR-GAE console</a></th>
          </tr></table></th>
  </tr>
</table>
<table border="0" cellpadding="0" cellspacing="0" width="100%%">
  <tr>
    <td align="left" class="footer">
    Generated by Epydoc 3.0.1 on Mon Sep  1 16:17:53 2008
    </td>
    <td align="right" class="footer">
      <a target="mainFrame" href="http://epydoc.sourceforge.net"
        >http://epydoc.sourceforge.net</a>
    </td>
  </tr>
</table>

<script type="text/javascript">
  <!--
  // Private objects are initially displayed (because if
  // javascript is turned off then we want them to be
  // visible); but by default, we want to hide them.  So hide
  // them unless we have a cookie that says to show them.
  checkCookie();
  // -->
</script>
</body>
</html>
